Skip to content

fix: preserve .tail text when removing empty elements (#1938)#1939

Merged
ntohidi merged 1 commit intodevelopfrom
fix/preserve-tail-text-1938
May 5, 2026
Merged

fix: preserve .tail text when removing empty elements (#1938)#1939
ntohidi merged 1 commit intodevelopfrom
fix/preserve-tail-text-1938

Conversation

@ntohidi
Copy link
Copy Markdown
Collaborator

@ntohidi ntohidi commented Apr 24, 2026

Summary

Test plan

  • Minimal reproduction: empty <span> with .tail text — tail now preserved
  • Between-elements reproduction: empty <b> between paragraphs — connector text preserved
  • All 17 existing scraping tests pass (mermaid SVG tests)

remove_empty_elements_fast() was dropping trailing text attached to
elements via lxml .tail when removing empty elements. Now appends
the tail to the previous sibling or parent before removal.
@ntohidi ntohidi merged commit a45c678 into develop May 5, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant